package com.sx.pipeline.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.noober.background.view.BLTextView
import com.sx.mvvmlibs.base.EasyAdapter
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.TaskConfig

/**
 * author : zhouyouqiang
 * e-mail : 1638473898@qq.com
 * date   : 2022/4/11 15:59
 * desc   : String适配器
 * version: 1.0
 */
class PushRangeAdapter(
    private val contexts: Context,
    private val releaseType: List<String>,
) : EasyAdapter<String,PushRangeViewHolder?>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PushRangeViewHolder {
        val view = View.inflate(contexts, R.layout.item_release_type, null)
        return PushRangeViewHolder(view)
    }

    override fun getItemCount(): Int {
        return releaseType.size
    }

    override fun whenBindViewHolder(holder: PushRangeViewHolder?, position: Int) {
        val data = releaseType[position]
        holder!!.tvName.tag = position //绑定
        holder.tvName.text=data
    }
}

class PushRangeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    var tvName: BLTextView = itemView.findViewById(R.id.tv_name)
}